Check for NULL pointer doesn't work for char pointer